/* chimaera_user.h : the bdb level interface to user table operations
*
* ====================================================================
* Copyright (c) 2000-2004 CollabNet.  All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution.  The terms
* are also available at http://subversion.tigris.org/license-1.html.
* If newer versions of this license are posted there, you may use a
* newer version instead, at your option.
*
* This software consists of voluntary contributions made by many
* individuals.  For exact contribution history, see the revision
* history and logs, available at http://subversion.tigris.org/.
* kkndyu@gmail.com
* ====================================================================
*/

#ifndef SVN_LIBSVN_FS_CHIMAERA_USER_H
#define SVN_LIBSVN_FS_CHIMAERA_USER_H

#define APU_WANT_DB
#include <apu_want.h>

#include "svn_fs.h"

#include "fs.h"
#include "trail.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

svn_error_t *
svn_fs_base__get_chimaera_user(	chimaerauser_t **chimaerauser_p, 
			svn_revnum_t id, svn_fs_t *fs, apr_pool_t *pool);
svn_error_t *
svn_fs_base__get_chimaera_userinfo(char **username,
		char **privilege, svn_string_t *user_ID,
		svn_revnum_t *id, svn_fs_t *fs, 
		apr_pool_t *pool);

svn_error_t *
svn_fs_base__check_system_user(svn_boolean_t *sysuser, 
			svn_revnum_t id, svn_fs_t *fs, apr_pool_t *pool);

/* insert or update user table  */
svn_error_t *
svn_fs_base__set_chimaera_user(chimaerauser_t *chimaerauser_p,
		svn_revnum_t *id, svn_fs_t *fs, apr_pool_t *pool);

svn_error_t *
svn_fs_base__set_chimaera_project(const char *project_name,
								  const char *root_path,
								  void *pinfo,
								  const char *group_leader,
								  const char *group,
                                  apr_time_t *check_time_nodes,
								  apr_byte_t time_nodes_num,
								  svn_revnum_t *id,char *founder,
								  svn_fs_t *fs, 
								  apr_pool_t *pool);
svn_error_t *
svn_fs_base__set_chimaera_message(chimaeramessage_t *chimaeramessage_p,
		svn_fs_t *fs, 
		apr_pool_t *pool);

svn_error_t *
svn_fs_base__get_chimaera_new_message(
		chimaeramessage_t **chimaeramessage_p,
		apr_int32_t *num,
		apr_int32_t  user_recno,
		svn_fs_t *fs, 
		apr_pool_t *pool);

int
svn_fs_base__check_chimaera_user_in_project(char *path, 
								apr_int32_t user_recno, 
								svn_fs_t *fs, apr_pool_t *pool);
svn_error_t *
svn_fs_base__set_chimaera_auth_s(char *path, apr_int32_t *new_s,
								 apr_int32_t  num, apr_int32_t user_recno,
								 svn_fs_t *fs, apr_pool_t *pool);

svn_error_t *
svn_fs_base__set_chimaera_auth_w(char *path, apr_int32_t *new_w,
								 apr_int32_t  num, apr_int32_t user_recno,
								 svn_fs_t *fs, apr_pool_t *pool);

svn_error_t *
svn_fs_base__set_chimaera_auth_r(char *path, apr_int32_t *new_w,
								 apr_int32_t  num, apr_int32_t user_recno,
								 svn_fs_t *fs, apr_pool_t *pool);

svn_error_t *
svn_fs_base__add_chimaera_notifier(char *path, apr_int32_t user_recno,
								   svn_fs_t *fs, apr_pool_t *pool);

svn_error_t *
svn_fs_base__del_chimaera_notifier(char *path, apr_int32_t user_recno,
								   svn_fs_t *fs, apr_pool_t *pool);

svn_error_t *
svn_fs_base__set_chimaera_nexteditor(char *path, apr_int32_t *next_editor,
						apr_int32_t user_recno, svn_fs_t *fs, apr_pool_t *pool);
svn_error_t *
svn_fs_base__check_chimaera_authz(const char *path,
								chimaera_authz_access_t required,
								apr_int32_t user_no,
            					svn_fs_t *fs, apr_pool_t *pool);
svn_error_t *
svn_fs_base__add_chimaera_file(char *full_path,
							svn_node_kind_t node_kind,
							apr_int32_t founder,
            						svn_fs_t *fs, apr_pool_t *pool);
svn_error_t *
svn_fs_base__get_chimaera_userlist(chimaerauserlist_t **list,
							 apr_int32_t *num,
							 apr_int32_t sign,
							 char *para,
							 svn_fs_t *fs, apr_pool_t *pool);
svn_error_t *
svn_fs_base__edit_chimaera_columns(apr_int32_t sign,
								   svn_string_t *key,
								   svn_string_t *value1,
								   svn_string_t *value2,
								   svn_string_t *value3,
								   apr_int32_t user,
								   svn_fs_t *fs,
								   apr_pool_t *pool);
svn_error_t *
svn_fs_base__get_chimaera_columns(apr_int32_t *group_recno,
								  apr_int32_t sign,
								  svn_string_t *key,
								  svn_string_t *value1,
								  apr_int32_t user,
								  svn_fs_t *fs,
								  apr_pool_t *pool);

svn_error_t *
svn_fs_base__chimaera_file_changed(char *full_path,
								  apr_int32_t user,
								  svn_fs_t *fs, apr_pool_t *pool);

svn_error_t *
svn_fs_base__del_chimaera_project(char *url,
							   apr_int32_t user,
							   svn_fs_t *fs,
							   apr_pool_t *pool);

svn_error_t *
svn_fs_base__insert_chimaera_user(char *username,
								  svn_string_t *userid,
								  apr_int32_t character,
								  svn_string_t *certificate,
								  char *userinfo,
								  apr_int32_t user,
								  svn_fs_t *fs,
								  apr_pool_t *pool);

svn_error_t *
svn_fs_base__remove_chimaera_user(svn_revnum_t user_recno,
							apr_int32_t user,
							svn_fs_t *fs,
							apr_pool_t *pool);

svn_error_t *
svn_fs_base__edit_chimaera_user(svn_revnum_t user_recno,
							char *username,
							svn_string_t *userid,
							apr_int32_t character,
							svn_string_t *certificate,
							char *userinfo,
							apr_int32_t user,
							svn_fs_t *fs,
							apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* SVN_LIBSVN_FS_REV_TABLE_H */
